package com.childenglish.entity;

import java.util.Date;

public class FileChunk {
    private Long id;
    private String fileMd5;
    private String fileName;
    private Integer chunkNumber;
    private Integer totalChunks;
    private Long chunkSize;
    private Long fileSize;
    private String chunkPath;
    private Date uploadTime;
    private Integer status; // 0:上传中, 1:上传完成, 2:合并完成

    // 构造函数
    public FileChunk() {}

    public FileChunk(String fileMd5, String fileName, Integer chunkNumber,
                     Integer totalChunks, Long chunkSize, Long fileSize) {
        this.fileMd5 = fileMd5;
        this.fileName = fileName;
        this.chunkNumber = chunkNumber;
        this.totalChunks = totalChunks;
        this.chunkSize = chunkSize;
        this.fileSize = fileSize;
        this.uploadTime = new Date();
        this.status = 0;
    }

    // Getter和Setter方法
    public Long getId() { return id; }
    public void setId(Long id) { this.id = id; }

    public String getFileMd5() { return fileMd5; }
    public void setFileMd5(String fileMd5) { this.fileMd5 = fileMd5; }

    public String getFileName() { return fileName; }
    public void setFileName(String fileName) { this.fileName = fileName; }

    public Integer getChunkNumber() { return chunkNumber; }
    public void setChunkNumber(Integer chunkNumber) { this.chunkNumber = chunkNumber; }

    public Integer getTotalChunks() { return totalChunks; }
    public void setTotalChunks(Integer totalChunks) { this.totalChunks = totalChunks; }

    public Long getChunkSize() { return chunkSize; }
    public void setChunkSize(Long chunkSize) { this.chunkSize = chunkSize; }

    public Long getFileSize() { return fileSize; }
    public void setFileSize(Long fileSize) { this.fileSize = fileSize; }

    public String getChunkPath() { return chunkPath; }
    public void setChunkPath(String chunkPath) { this.chunkPath = chunkPath; }

    public Date getUploadTime() { return uploadTime; }
    public void setUploadTime(Date uploadTime) { this.uploadTime = uploadTime; }

    public Integer getStatus() { return status; }
    public void setStatus(Integer status) { this.status = status; }

    @Override
    public String toString() {
        return "FileChunk{" +
                "id=" + id +
                ", fileMd5='" + fileMd5 + '\'' +
                ", fileName='" + fileName + '\'' +
                ", chunkNumber=" + chunkNumber +
                ", totalChunks=" + totalChunks +
                ", chunkSize=" + chunkSize +
                ", fileSize=" + fileSize +
                ", uploadTime=" + uploadTime +
                ", status=" + status +
                '}';
    }
}